#include <stdio.h>
int main()
{
	int n,a[100][100];
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			scanf("%d",&a[i][j]);
		}
	}
	int row=0,col=0,direction=1;
	for(int i=0;i<n*n;i++)
	{
		printf("%d ",a[row][col]);
		if(direction==1)
		{
			if(col==n-1)
			{
				row++;
				direction=-1;
			}
			else if(row==0)
			{
				col++;
				direction=-1;
			}
			else
			{
				row--;
				col++;
						  }              
	    
	}
	else{
		if(row==n-1)
		{
			col++;
			direction=1;
		}
		else if(col==0)
		{
			row++;
			direction=1;
		}
		else
		{
			row++;
			col--;
		}
} 

}
return 0;
}
